// with polyfills
import 'core-js/stable'
import 'regenerator-runtime/runtime'
// pre loading for svg animation
import './assets/js/preloading'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/'
import filters from '@/filters/index'
import i18n from './locales'
import { VueAxios } from './utils/request'
import ProLayout, { PageHeaderWrapper } from '@jxstjh/ant-pro-layout'
import themePluginConfig from '../config/themePluginConfig'

// mock
// WARNING: `mockjs` NOT SUPPORT `IE` PLEASE DO NOT USE IN `production` ENV.
import './mock'

import bootstrap from './core/bootstrap'
import './core/lazy_use' // use lazy load components
import './permission' // permission control
import './utils/filter' // global filter
import animated from 'animate.css'
// 全局使用 滚动条
import PerfectScrollbar from 'vue2-perfect-scrollbar'
import 'vue2-perfect-scrollbar/dist/vue2-perfect-scrollbar.css'

// 全局loading
import Loading from '@jxstjh/vue-loading-overlay'
import '@jxstjh/vue-loading-overlay/dist/vue-loading.css'

import './global.less' // global style
import VueGridLayout from 'vue-grid-layout'
// 远程卡片加载器
import vueModuleLoader from '@jxstjh/vue-module-loader'
Vue.use(Loading)
Vue.use(animated)
Vue.use(PerfectScrollbar)
Vue.use(vueModuleLoader, { router, store })

Vue.config.productionTip = false

// mount axios to `Vue.$http` and `this.$http`
Vue.use(VueAxios)
// use pro-layout components
Vue.component('pro-layout', ProLayout)
Vue.component('page-container', PageHeaderWrapper)
Vue.component('page-header-wrapper', PageHeaderWrapper)
// use vue gridcomponent
Vue.component('grid-layout', VueGridLayout.GridLayout)
Vue.component('grid-item', VueGridLayout.GridItem)

// 全局filter过滤条件
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

window.umi_plugin_ant_themeVar = themePluginConfig.theme
// mock get userInfo
window.app = new Vue({
  router,
  store,
  i18n,
  // init localstorage, vuex
  created: bootstrap,
  render: h => h(App)
}).$mount('#app')
